package milktea.service.impl;

import java.util.ArrayList;
import java.util.List;

import milktea.dao.IUsersDao;
import milktea.dao.impl.UsersDao;
import milktea.model.Users;
import milktea.service.IUsersService;

public class UsersService implements IUsersService {

	@Override
	public int insert(Users users) {
		IUsersDao usDao = new UsersDao();
		return usDao.insert(users);
	}

	@Override
	public List<Users> select() {
		IUsersDao usdao = new UsersDao();
		List<Users> list = new ArrayList<Users>();
		list = usdao.select();
		return list;
	}

	@Override
	public Users checkLogin(String userName, String userPass) {
		IUsersDao usdao = new UsersDao();
		List<Users> list = new ArrayList<Users>();
		list = usdao.checkLogin(userName, userPass);
		return list.size() != 0? list.get(0):null;
	}

}
